//! Header for the class Finder
#ifndef FINDER_H
#define FINDER_H
//! Represents the Finder Visitor (Visitor pattern)
/*!
	The class Finder searches for medias which contain
	the search string and adds found medias to a list.
	\class Finder
	\author Andreas Lehner
	\date 06.12.2012
*/
#include <list>
#include "IVIsitor.h"
#include "MusicMedia.h"

typedef std::list<MusicMedia*> TMedia;

class Finder : public IVisitor {
public:
	//! CTor of class Finder
	/*!
		The CTor initializes the search string that will be
		searched for in a given media.
		\param search The string that will be searched for.
	*/
	Finder(std::string const& search): mSearch(search){}
	void Visit(Song * song);
	void Visit(Album * album);
	void Visit(MusicCollection * collection);
	//! Returns a pointer to the list of MusicMedia.
	/*!
		Returns a pointer to the list of MusicMedia.
		Is used by the visitors.
		\returns A const Pointer to the list of MusicMedia
	*/
	TMedia const* getMedia() const;

private:
	//helper method to find a string contained in
	//another string, used to find names of medias
	bool findstr(std::string const& search) const;
	//list where found medias are stored
	TMedia mFoundMedia;
	//string which will be searched for
	std::string mSearch;
};

#endif